﻿/** \file
* \$Rev$
* 
* \$Date$
*
* \$URL$
*/

using System;

namespace BT211
{
	/// <summary>
	/// A static utility class containing physics functions.
	/// </summary>
	public static class Physics
	{
		/// <summary>Get the Euclidean distance between two play objects.</summary>
		/// <param name="o1">The first play object.</param>
		/// <param name="o2">The second play object.</param>
		/// <returns>The distance between the two.</returns>
		public static double Distance(IPlayObjectView o1, IPlayObjectView o2)
		{
			double dx = o1.Px - o2.Px, dy = o1.Py - o2.Py;
			return Math.Sqrt(dx * dx + dy * dy);
		}

		/// <summary>Converts from degrees to radians.</summary>
		/// <param name="deg">An angle in degrees.</param>
		/// <returns>That angle in radians.</returns>
		public static double DegToRad(double deg) { return deg * Math.PI / 180; }

		/// <summary>Converts from radians to degrees.</summary>
		/// <param name="rad">An angle in radians.</param>
		/// <returns>That angle in degrees.</returns>
		public static double RadToDeg(double rad) { return rad * 180 / Math.PI; }
	}
}
